package com.gmcc.docmanager.loader;

import java.io.InputStream;

import org.apache.http.HttpResponse;

public class ApplyAuthorizationResponseParser extends ResponseParser {

	public ApplyAuthorizationResponseParser(ResponseListener listener) {
		super(listener);
	}

	@Override
	public void doParse(String url, HttpResponse httpresp, InputStream is,
			String postData) {
		super.doParse(url, httpresp, is, postData);

		if (netResult && rootElement != null) {
			int errorCode = 1;
			errorCode = stringToInt(getNodeTextValue("errorCode"));
			if (errorCode != 0) {
				response(createFailureResponse(errorCode));
			} else {
				Response response = new Response();
				response.setCode(errorCode);
				response(response);
			}
		}
	}
}
